<?php

namespace App\Store\Validate\Financial\Business;

use App\Common\Validate\BaseValidate;

/**
 * 权限组验证器
 */
class OtherPay extends BaseValidate
{

    //验证规则
    protected $rule = [];
    //自定义验证信息
    protected $message = [];
    public function __construct($doaction = 'sdata')
    {
        if ($doaction == 'sdata') {
            $this->rule = [
                // 'type' => 'required|in:1,2,3,4,5,6,7,8',
                'abstract' => 'required',
                'subject_id' => 'required|integer|gte:-5',
                'in_money' => 'required|integer|gte:0',
                'out_money' => 'required|integer|gte:0',
            ];
            $this->message = [
                'type.required' => '参数错误',
                'type.in' => '参数错误',
                'abstract.required' => '摘要未填写',
                'subject_id.required' => '科目未选择',
                'subject_id.integer' => '科目参数错误',
                'subject_id.gte' => '科目参数错误',
                'in_money.required' => '收入金额不能为空',
                'in_money.integer' => '收入金额参数错误',
                'in_money.gte' => '收入金额参数错误',
                'out_money.required' => '支出金额不能为空',
                'out_money.integer' => '支出金额参数错误',
                'out_money.gte' => '支出金额参数错误',
            ];
        } elseif ($doaction == 'edit') {
            $this->rule = [
                'id' => 'required|integer|gt:0',
                'goods_category_id' => 'required|integer|gt:0',
                'goods_style_id' => 'required|integer|gt:0',
                'safety_stock_min' => 'required|integer|gt:0',
                'safety_stock_max' => 'required|integer|gt:0',
                'warning_stock' => 'required|integer|gt:0',
            ];
            $this->message = [
                'id.required' => '参数错误',
                'id.integer' => '参数错误',
                'id.gt' => '参数错误',
                'goods_category_id.required' => '商品类别未选择',
                'goods_category_id.integer' => '商品类别参数错误',
                'goods_category_id.gt' => '商品类别参数错误',
                'goods_style_id.required' => '款式未选择',
                'goods_style_id.integer' => '款式参数错误',
                'goods_style_id.gt' => '款式参数错误',
                'safety_stock_min.required' => '安全库存区间最小值未填写',
                'safety_stock_min.integer' => '安全库存区间最小值参数错误',
                'safety_stock_min.gt' => '安全库存区间最小值参数错误',
                'safety_stock_max.required' => '安全库存区间最大值未填写',
                'safety_stock_max.integer' => '安全库存区间最大值参数错误',
                'safety_stock_max.gt' => '安全库存区间最大值参数错误',
                'warning_stock.required' => '异常库存不能为空',
                'warning_stock.integer' => '异常库存参数错误',
                'warning_stock.gt' => '异常库存参数错误',
            ];
        }
    }
}
